//
//  BackupsSwitchView.swift
//  imprint
//
//  Created by 小柠檬🍋 on 2025/1/27.
//

import SwiftUI

//聊天功能弹窗
struct ChatFunctionDialogView: View {
    let click: (Int) -> Void
    
    var body: some View {
        PopupBottomView(title: "请选择功能") {
            VStack(spacing: 15) {
                HStack() {
                    VStack(alignment: .leading) {
                        Text("AI设置")
                            .font(.system(size: 16))
                            .foregroundStyle(.bgNormalText2)
                    }
                    Spacer()
                }.padding(.horizontal,15)
                    .frame(height: 80)
                    .background(.bgItemGray)
                    .cornerRadius(15)
                    .contentShape(Rectangle())
                    .onTapGesture {
                        click(0)
                    }
                HStack() {
                    VStack(alignment: .leading) {
                        Text("聊天设置")
                            .font(.system(size: 16))
                            .foregroundStyle(.bgNormalText2)
                    }
                    Spacer()
                }.padding(.horizontal,15)
                    .frame(height: 80)
                    .background(.bgItemGray)
                    .cornerRadius(15)
                    .contentShape(Rectangle())
                    .onTapGesture {
                        click(1)
                    }
                HStack() {
                    VStack(alignment: .leading) {
                        Text("清空聊天记录")
                            .font(.system(size: 16))
                            .foregroundStyle(.bgNormalText2)
                        Text("清空后当前的角色聊天记录将全部清空，无法恢复")
                            .font(.system(size: 12))
                            .foregroundStyle(.bgNormalText4)
                    }
                    Spacer()
                }.padding(.horizontal,15)
                    .frame(height: 80)
                    .background(.bgItemGray)
                    .cornerRadius(15)
                    .contentShape(Rectangle())
                    .onTapGesture {
                        click(2)
                    }
                HStack() {
                    VStack(alignment: .leading) {
                        Text("结束话题")
                            .font(.system(size: 16))
                            .foregroundStyle(.bgNormalText2)
                        Text("结束后，下次聊天将不会联系上下文")
                            .font(.system(size: 12))
                            .foregroundStyle(.bgNormalText4)
                    }
                    Spacer()
                }.padding(.horizontal,15)
                    .frame(height: 80)
                    .background(.bgItemGray)
                    .cornerRadius(15)
                    .contentShape(Rectangle())
                    .onTapGesture {
                        click(3)
                    }
                
            }.padding(.top,15)
                
        }
    }
}

//#Preview {
//    ChatFunctionDialogView()
//}
//定义预览提供者
struct ChatFunctionDialogView_Previews: PreviewProvider {
    static var previews: some View {
        //使用预览共享配置
        configurePreviewEnvironment(for: ChatFunctionDialogView(){_ in })
    }
}
